<?php

class eveBrowser
{
        public $pilotName;
        public $allianceName;
        public $corpName;
        public $trusted;
        public $claimsUrl;

        function __construct($urlIn)
        {
                $this->claimsUrl = $urlIn;
        }

        /*
         * Attempt to gain trust from the client.
         * May cause a page reload.
         */
        function getTrust2()
        {
                $browser = $_SERVER['HTTP_USER_AGENT'];
                if (strstr($browser, "EVE-IGB") === false)
                        $ingame = false;
                else
                        $ingame = true;

                if ($ingame)
                {
                        // check for trust
                        if ($_SERVER['HTTP_EVE_TRUSTED']=='No')
                        {
                                ?>
                                        <body bgcolor="black">
                                                <script type="text/javascript">
                                                        CCPEVE.requestTrust('<? echo $this->claimsUrl; ?>');
                                                </script>
                                                <center>
                                                        <button type="button" onclick="window.location.reload()">Trust me (<? echo $this->claimsUrl; ?>) and then click here</button>
                                                </center>
                                <?
                                exit;
                        }
                        else
                        {
                                $this->trusted = true;
                                $this->pilotName = $_SERVER['HTTP_EVE_CHARNAME'];

                                if (isset($_SERVER['HTTP_EVE_ALLIANCENAME']))
                                        $this->allianceName = $_SERVER['HTTP_EVE_ALLIANCENAME'];
                                else
                                        $this->allianceName = "None";

                                $this->corpName = $_SERVER['HTTP_EVE_CORPNAME'];
                        }
                }
        }

}

